package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.usersaction;

import com.alstudio.module.xmpp.protocol.xmpp.packact.ALXmppDomainConfig;
import com.alstudio.module.xmpp.protocol.xmpp.packact.IQNameSpace;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.AlXmlTag;
import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq.BaseIQTemplate;

/**
 * 请求黑名单iq 
 * @author alonso lee
 *
 */
public class CheckBlackListIQCreator extends BaseIQTemplate {
	
	public CheckBlackListIQCreator(String domain) {
		// TODO Auto-generated constructor stub
		this.domain = domain;
	}

	@Override
	public String getIQXml() {
		// TODO Auto-generated method stub
		
		String ns = IQNameSpace.NS_BLACK_LIST;

		AlXmlTag tag = new AlXmlTag("list");
		tag.setAtt("name", "blacklist");
		tagList.add(tag);

		mALIQCreator.setNs(ns);

		mALIQCreator.setType(IQ_TYPE_GET);
		to = ALXmppDomainConfig.getALXmppDomainConfig()
				.getDomainByNameSpace(ns);
		mALIQCreator.setTo(to + domain);

		String xml = "";
		try {
			xml = mALIQCreator.getXml();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return xml;
	}

}
